<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="java.text.SimpleDateFormat"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<%@include file="/views/common/include/taglib.jsp"%>
<%@include file="/views/common/include/head.jsp"%>
<link rel="stylesheet" href="${ctx}/css/page/header2.css" type="text/css">
<link rel="stylesheet" href="${ctx}/css/page/reset.css" type="text/css">
<link rel="stylesheet" href="${ctx}/css/page/qrdd.css" type="text/css">
<link rel="stylesheet" href="${ctx}/css/page/shangchennav.css" type="text/css">
<link rel="stylesheet" href="${ctx}/css/page/footer.css" type="text/css">
<link rel="stylesheet" href="${ctx}/css/page/page.css" type="text/css">
<link rel="stylesheet" href="${ctx}/css/page/person-my.css" type="text/css">
<link rel="stylesheet" href="${ctx}/css/page/reset.css" type="text/css">
<script src="${ctx}/js/controllers/mall/confirm_order.js" type="text/javascript"></script>
<style type="text/css">
</style>
<style>
    .house-add{border-radius:5px;}
    .house-add .layui-layer-title{height:63px;background:#619AC7;line-height:63px;color:#fff;font-size:17px;text-align:center;border-radius:5px 5px 0 0;}
    .house-add .layui-layer-setwin .layui-layer-close1{width:25px;height:25px;}
</style>
</head>
<body>
<script type="text/javascript">
    var ctx = '${ctx}';
    setCtx(ctx);
</script>
<%
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    String cDate = sdf.format(new Date());
%>
    <jsp:include page="/views/common/head_main.jsp" />
    <div class="bg">
    <input type="hidden" id="item" value="${sessionScope.item_mall}"/>
        <div class="contentbox1 contentbox">
            <div class="nav">
                 <ul>
                    <li><a href="${ctx}/main?item=4">商城首页</a></li><span>|</span>
                    <li><a href="${ctx}/mallSeckill">秒杀专区</a></li><span>|</span>
                    <li><a href="${ctx}/main?item=4#article">精品推荐</a></li><span>|</span>
                    <li><a href="${ctx}/main?item=4#hotshop">热门商铺</a></li><span>|</span>
                    <li><a href="${ctx}/mallIntegral">积分专区</a></li>
                </ul>
                <div class="seabox">
					<select class="searchhh" id="selectType">
					<option value="1">商品</option>
					<option value="2">店铺</option>
					</select>
					<input class="search" type="text" id="name"></input><button class="searchbtn" onclick="searchGoodsOrShops()">搜索</button>
				</div>
                <div class="cartbox">
                     <img src="${ctx}/images/mall/cart.png">&nbsp;&nbsp;&nbsp;<a href="${ctx}/shopcart/shopcartList" target="_blank">我的购物车</a>
                </div>
            </div>
        </div>
        <div class="contentbox2 contentbox">
            <div class="padd">
                <div class="cart-head">
                    <div class="cart-jdt">
                        <span class="cart-title">确认订单信息</span> <img
                            src="${ctx}/images/qrdd/qr5.png">
                    </div>
                    <p class="cart-all-item over-flow"><span class=" address-left" >确定收货地址</span><a href="${ctx}/ownerAddress/ownerAddressList"><span class="address-right">管理收货地址</span></a></p>
                    <hr/>
                </div>
                <div class="s-address">
                    <div class="wrap over-flow">
                        <c:forEach items="${addressList}" var="addressVo" varStatus="addressStatus">
                            <div class="address-box">
                                <c:if test="${addressVo.defaultFlag == 1}">
                                    <img id="addSrc_${addressVo.id}_${addressVo.defaultFlag}" src="${ctx}/images/qrdd/qr1.png">
                                </c:if>
                                <c:if test="${addressVo.defaultFlag == 0}">
                                    <img id="addSrc_${addressVo.id}_${addressVo.defaultFlag}" src="${ctx}/images/qrdd/qr4.png">
                                </c:if>
                                <div class="person-info">
                                    <div class="padd4">
                                        <p>${addressVo.recepientName}</p>
                                        <p>${addressVo.detailAddress}</p>
                                        <p>${addressVo.recepientPhone}</p>
                                    </div>
                                </div>
                            </div>
                        </c:forEach>
                    </div>
                    <div class="btn-box">
                    	<button class="new-add" style="margin-left:10px;">+使用新地址</button>
                    </div>
                </div>
                <div class="cart-main">
                    <p class="cart-all-item over-flow"><span class=" address-left" >确认订单信息</span><a href="${ctx}/shopcart/shopcartList"><span class="address-right">返回修改购物车</span></a></p>
                    <c:forEach items="${shopcart}" var="shopcartVo" varStatus="shopcartStatus">
                        <div class="order-list">
                            <div style="height:auto">
                                <div class="order-body">
                                    <div class="cart-table-th">
                                        <div class="wp">
                                            <div class="th th-item">
                                                <input type="hidden" name="shopId" value="${shopcartVo.shopId}"/>
                                                <a href="" class="shop-name"><img src="${ctx}/images/gwc/shop.png">&nbsp;&nbsp;&nbsp;${shopcartVo.shopName}</a>
                                            </div>
                                            <div class="th th-price">单价</div>
                                            <div class="th th-amount">数量</div>
                                            <div class="th th-op">小计</div>
                                        </div>
                                    </div>
                                    <div class="order-content">
                                        <div class="one-shop-all-item">
                                            <c:forEach  items="${shopcartVo.goodsList}" var="goods" varStatus="goodsStatus">
                                            <div class="one-order">
                                                <div class="padd3">
                                                    <ul class="over-flow">
                                                        <li class="td td-item">
                                                            <div class="item-pic">
                                                                <img src="${sessionScope.image_logo}${goods.goodsLogo}" />
                                                            </div>
                                                            <div class="item-info">
                                                                <a href="javascript:void(0)" class="item-name">${goods.goodsName}</a>
                                                                <p class="item-spc">${goods.memo}</p>
                                                            </div>
                                                        </li>
                                                        <li class="td td-price">
                                                        <span class="price-now">￥${goods.price}<c:if test="${type == 2 }">积分</c:if></span>
                                                        </li>
                                                        <li class="td td-amount">${goods.amount}</li>
                                                        <li class="td td-op">￥${goods.subTotal}<c:if test="${type == 2 }">积分</c:if></li>
                                                    </ul>
                                                </div>
                                            </div>
                                            </c:forEach>
                                        </div>
                                        <div class="message-box">
                                            <div class="padd2">
                                                <ul class="fuc-list">
                                                    <li class="float-l">给卖家留言：<input style="margin-left:23px;" class="input-text" type="text" name="message"></li>
                                                    <%-- <c:if test="${type == 1 }"> --%>
                                                    <li class="float-r">配送方式：<select style="width:250px;" id="${shopcartVo.shopId}_${shopcartVo.carriage}_${shopcartVo.derateAmount}" name="dist_type"><option value="0">送货上门</option><option value="1">自提</option></select> <span class="m-price">￥<span id="carriage_${shopcartVo.shopId}">${shopcartVo.carriage}</span>元</span></li>
                                                    <%-- </c:if> --%>
                                                    <li>期望收货时间：<input style="margin-left:10px;width:150px;" type="text" name="receive_time" onfocus="WdatePicker()" class="inputtext input-text Wdate" style="width:120px"
                                                        value="<%=cDate%>" id="${shopcartVo.shopId}"/></li>
                                                    <%-- <c:if test="${type == 1 }"> --%>
                                                    <li class="float-r">运费减免<span class="small-blue">(满${shopcartVo.derateLine}减运费)：</span><span class="m-price">-￥${shopcartVo.derateAmount}元</span></li>
                                                    <%-- </c:if> --%>
                                                </ul>
                                            </div>
                                        </div>
                                        <input type="hidden" id="shop_carriage_${shopcartVo.shopId}" value="${shopcartVo.carriage}"/>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </c:forEach>
                    <c:if test="${type == 1 }">
                    <div class="yh-box">
                        <img src="${ctx}/images/qrdd/yhj2.png" id="coupon_src" onclick="selectCoupon();">&nbsp;&nbsp;&nbsp;使用优惠券<!-- <span class="small-blue">共4张可用</span> -->
                        <ul>
                        <li>
                            <table id="discout_tab" style="display:none">
                                <c:forEach items="${couponList}" var="coupon" varStatus="couponStatus">
                                    <tr>
                                        <td align="right">
                                            <c:if test="${coupon.couponType == 1}">平台优惠券：</c:if>
                                            <c:if test=""></c:if>
                                            <c:if test="${coupon.couponType != 1}">
                                                ${coupon.shopName}优惠券：
                                            </c:if>
                                        </td>
                                        <td>
                                            <select style="width:180px" id="${coupon.couponType}_${coupon.shopId}" name="coupon_select">
                                                <option value="">--请选择您的优惠券--</option>
                                                <c:forEach  items="${coupon.detailList}" var="detail" varStatus="detailStatus">
                                                    <option value="${coupon.couponType}_${coupon.shopId}_${detail.couponDetailId}_${detail.breakPrice}_${detail.breakLine}">${detail.couponDesc}</option>
                                                </c:forEach>
                                            </select>
                                        </td>
                                    </tr>
                                </c:forEach>
                                <!-- <tr>
                                    <td align="right">商鋪B优惠券:</td>
                                    <td><select><option>商鋪A优惠券</option></select></td>
                                </tr>
                                <tr>
                                    <td align="right">平台优惠券:</td>
                                    <td><select><option>商鋪B优惠券</option></select></td>
                                </tr> -->
                            </table>
                        </li>
                        </ul>
                    </div>
                    </c:if>
                    <div class="pay-wrap">
                        <p class="cart-all-item over-flow">
                            <span class=" address-left">选择支付方式</span>
                        </p>
                        <div class="pay-type-box">
                            <div class="pay-type">
                            	<input type="checkbox" class="zhifubao" id="aliPay" onclick="checkPayType(this)" value="1"><img src="${ctx}/images/qrdd/zhifubao.png">支付宝支付   
                            </div>
                            <div class="pay-type">
                                <input type="checkbox" id="wxPay" value="2" onclick="checkPayType(this)"><img src="${ctx}/images/qrdd/weixin.png">微信支付
                            </div>
                        </div>
                    </div>
                    <div class="box-final">
                        <table width="100%">
                            <tr>
                                <td class="text-r">共<span>2</span>件商品，总商品金额：
                                </td>
                                <td width="10%" class="text-l">￥${total}<c:if test="${type == 2 }">积分</c:if></td>
                            </tr>
                            <c:if test="${type == 1 }">
                            <tr>
                                <td class="text-r">优惠券抵扣：</td>
                                <td class="text-l">￥<span id="discountAmount">0.00</span></td>
                            </tr>
                            </c:if>
                            <tr>
                                <td class="text-r">总运费：</td>
                                <td class="text-l">￥<span id="carriage_total">${carriageTotal}</span></td>
                            </tr>
                            <tr>
                                <td colspan="2" class="last-step">
                                    <div class="return-cart">
                                        <a style="line-height: 70px;" href="${ctx}/shopcart/shopcartList">返回修改购物车</a>
                                    </div>
                                    <input type="hidden" id="hiddenTotalPrice" value="0.00" />
                                    <span>应付总额：<span class="price-color" id="totalPrice">￥<span id="realTotalHtml"><c:if test="${type != 2 }">${realTotal}</c:if>
                                    <c:if test="${type == 2 }">${carriageTotal}</c:if></span></span>
                                        <button class="pay-btn" id="submitOrder">确认订单</button></span>
                                </td>
                            </tr>
                        </table>
                        <input type="hidden" id="goodsType" value="${type}"/>
                        <input type="hidden" id="total" value="${total}"/>
                        <input type="hidden" id="realTotal" value="${realTotal}"/>
                        <input type="hidden" id="shopcartIds" value="${shopcartIds}"/>
                        <input type="hidden" id="couponAmount" value="0"/>
                        <input type="hidden" id="couponIds" />
                        <input type="hidden" id="carriageTotal_hidden" value="${carriageTotal}"/>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div id="returnAli"></div>
    <jsp:include page="/views/common/footer.jsp" />
</body>
</html>